import Packet from "../net/Packet"

// 获取账号角色列表
export default class AccountRoles {
	/**
	 * @param sid 服务器ID
	 */
	public constructor(public sid: number) { }

	public encode(): Packet {
		const packet = this._encode()
		packet.Encode(2030)
		return packet
	}

	public encodeMsg(): ByteBuffer {
		return this._encode().GetBuffer()
	}

	public static decode(packet: Packet): AccountRoles {
		const sid = packet.ReadUshort()
		return new AccountRoles(sid)
	}

	private _encode(): Packet {
		const packet = new Packet()
		packet.WriteUshort(this.sid)
		return packet
	}
}
